// class
//旧的定义原型对象
// function Person(name) {
//     this.name = name
// }
// Person.prototype.say = function() {
//     console.log(`hi, my name is ${this.name}`)
// }

// ES6 es2015 
class Person {
    // 构造函数
    constructor(name) {
        this.name = name
    }
    say() {
        console.log(`hi, my name is ${this.name}`) 
    }
}
const person1 = new Person('tom')
person1.say()